﻿<Window x:Class="Cjc.ThreeDeemium.Window1"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:cjc="clr-namespace:Cjc.ChromiumBrowser;assembly=Cjc.ChromiumBrowser"
		xmlns:properties="clr-namespace:Cjc.ThreeDeemium.Properties"
		xmlns:effect="clr-namespace:ShaderEffectLibrary"
		xmlns:local="clr-namespace:Cjc.ThreeDeemium"
		Title="WPF Chromium Browser" Name="window"
		Width="900" Height="600" Background="White">

	<Window.Resources>
		<BooleanToVisibilityConverter x:Key="boolVisibility"/>
	</Window.Resources>

	<Grid Name="grid">

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<cjc:WebBrowser Name="browser" Grid.Row="1" Status="browser_Status" ReceiveTitle="browser_ReceiveTitle"
						RenderTransformOrigin="0.5,0.5" TabIndex="2" Focusable="True" EnableAsyncRendering="False" 
						Effect="{Binding SelectedItem.Value, ElementName=effects}">
			<cjc:WebBrowser.LayoutTransform>
				<TransformGroup>
					<RotateTransform Angle="{Binding Value, ElementName=angle}"/>
					<ScaleTransform ScaleX="{Binding Value, ElementName=scale}" ScaleY="{Binding Value, ElementName=scale}"/>
				</TransformGroup>
			</cjc:WebBrowser.LayoutTransform>
		</cjc:WebBrowser>

		<Grid Name="header" Grid.Row="0" VerticalAlignment="Top" Background="#80FFFFFF" Focusable="False">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition/>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<Button Grid.Column="0" Name="back" Content="&lt;" VerticalAlignment="Center"
					Margin="5,0,0,0" Click="back_Click"/>
			<Button Grid.Column="1" Name="forward" Content="&gt;" VerticalAlignment="Center"
					Margin="2,0,0,0" Click="forward_Click"/>
			<TextBlock Grid.Column="2" Text="Address" Margin="5" VerticalAlignment="Center" Focusable="False"/>
			<TextBox Name="address" Grid.Column="3" Margin="0,5,0,5" VerticalAlignment="Center"
					 Text="{Binding Source, Mode=OneWay, ElementName=browser}" TabIndex="0" />
			<Control Name="loading" Grid.Column="4" Template="{StaticResource loadingAnimation}" Foreground="Green"
					 Width="20" Margin="5,5,0,5" Visibility="Collapsed" />
			<Button Grid.Column="5" Content="Go" Margin="5,5,0,5" Click="Button_Click" VerticalAlignment="Center"
					TabIndex="1" Focusable="True" IsDefault="{Binding IsKeyboardFocused, ElementName=address}"/>
			<Button Grid.Column="6" Content="Set default" Margin="5" Click="Default_Click" VerticalAlignment="Center"
					TabIndex="1" Focusable="True"/>
		</Grid>

		<ListBox Name="status" Grid.Row="1" Foreground="Red" IsHitTestVisible="False" BorderThickness="0"
				 ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
				 Visibility="{Binding IsChecked, ElementName=debug, Converter={StaticResource boolVisibility}}"
				 Padding="5" Background="#D0F8F8F8" HorizontalAlignment="Left" VerticalAlignment="Top"/>

		<Grid Grid.Row="2" Background="#80FFFFFF">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>
			<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="5,5,0,5">
				<TextBlock Text="Debug" VerticalAlignment="Center"/>
				<CheckBox Name="debug" VerticalAlignment="Center" Margin="5,0,0,0"/>
			</StackPanel>
			<TextBlock Grid.Column="1" VerticalAlignment="Center" Margin="5,5,0,5" Text="Rotate"/>
			<Slider Grid.Column="2" Name="angle" Minimum="-180" Maximum="180" VerticalAlignment="Center"
				Focusable="False" Margin="5,5,0,5" />
			<TextBlock Grid.Column="3" VerticalAlignment="Center" Margin="5,5,0,5" Text="Scale"/>
			<Slider Grid.Column="4" Name="scale" Minimum="0.5" Maximum="3" VerticalAlignment="Center" Value="1" 
				Focusable="False" Margin="5,5,0,5" />
			<ComboBox Grid.Column="5" VerticalAlignment="Center" Name="effects" Margin="5,5,0,5" SelectedIndex="0"
					  ItemsSource="{Binding Effects, ElementName=window}" DisplayMemberPath="Key" SelectedValuePath="Value"/>
			<Button Grid.Column="6" Name="openTransparent" Content="Open transparent" Margin="5"
					Click="openTransparent_Click" VerticalAlignment="Center"/>
		</Grid>

	</Grid>
</Window>
